package cn.tedu.straw.portal.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/test")
@RestController
public class TestController {

    // http://localhost:8080/test/add
    @PreAuthorize("hasAuthority('增')")
    @GetMapping("/add")
    public String add() {
        return "test > add";
    }

    // http://localhost:8080/test/delete
    @PreAuthorize("hasAuthority('删')")
    @GetMapping("/delete")
    public String delete() {
        return "test > delete";
    }

    // http://localhost:8080/test/update
    @PreAuthorize("hasAuthority('改')")
    @GetMapping("/update")
    public String update() {
        return "test > update";
    }

    // http://localhost:8080/test/query
    @PreAuthorize("hasAuthority('查')")
    @GetMapping("/query")
    public String query() {
        return "test > query";
    }

}
